<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        /*html{*/
        /*    cursor:url("https://cdn.calamus.xyz/cursor/ai2.png"),default !important;*/
        /*}*/

        .box{
            width: 330px;
            background: #f8f8f8;
            margin:50px auto;
        }
        input{
            height: 80px;
            width: 99%;
            outline: none;
            font-size: 35px;
        }

        ul {
            display: flex;
            width: 100%;
            flex-wrap: wrap;
        }
        ul li{
            list-style: none;
            width: 80px;
            height: 80px;
            text-align: center;
            line-height: 80px;
            border: 1px solid white;
            border-radius: 50%;
            cursor: pointer;
            font-size: 25px;
            background: #ffd571;
        }

        .fh{
            background: #ffa36c;
        }

    </style>
</head>
<body>

<div class="box">

    <input id="inputValue" type="text" disabled="disabled">

    <ul id="ul-li">
        <li class="fh">(</li>
        <li class="fh">)</li>
        <li class="fh">%</li>
        <li class="fh">C</li>
        <li>7</li>
        <li>8</li>
        <li>9</li>
        <li class="fh">/</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li class="fh">*</li>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li class="fh">-</li>
        <li>0</li>
        <li>.</li>
        <li>=</li>
        <li class="fh">+</li>
    </ul>
</div>
<a href="8-20-work-1.html">轮播图</a>

</body>

<script>
    var ulli = document.getElementById('ul-li').getElementsByTagName('li')
    var inputValue = document.getElementById('inputValue')
    var str = ''
    for (var i = 0;i<ulli.length;i++){
        ulli[i].onclick = function () {
            if (this.innerText==='='){
                try {
                    inputValue.value = eval(str)
                }catch(e){
                    inputValue.value = '错误'
                }
            }

            if (this.innerText==='C'){
                inputValue.value = ''
                str = ''
            }

            if (this.innerText!=='C'&&this.innerText!=='='){
                console.log(this.innerHTML)
                str+=this.innerText
                inputValue.value = str
            }
        }
    }
</script>

</html>